package com.wu.pmo.controller;

import com.wu.pmo.entity.Customers;
import com.wu.pmo.service.CustomersService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;


@RestController
@RequestMapping("/api")
public class CustomersController {

    @Autowired
    private CustomersService customersService;

    @GetMapping("/customers")
    public ResponseEntity<List<Customers>> getAllCustomers() {
        List<Customers> customers = customersService.list();
        return ResponseEntity.ok(customers);
    }
}